package vincent.com.layouttest;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

import vincent.com.layouttest.view.RotateSwitch;

/**
 * Created by chenzhengwen on 2015/6/8.
 */
public class CircleSwitchActivity extends ColorStatusActivity implements View.OnClickListener{
    private RotateSwitch rotateSwitch;
    private Button changePosition;
    private int angle = 0;

    private EditText angleInput;

    private Handler mHandler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch(msg.what){
                case 1:
                    rotateSwitch.setCirclePosition(angle++);
                    mHandler.sendEmptyMessageDelayed(1, 100);
                    break;
            }
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_circle_switch);

    /*    rotateSwitch = (RotateSwitch)findViewById(R.id.rotate_switch);
        changePosition = (Button)findViewById(R.id.change_position);
        angleInput = (EditText)findViewById(R.id.angle);
//        mHandler.sendEmptyMessage(1);
        changePosition.setOnClickListener(this);*/
    }

    @Override
    public View onCreateView(ViewGroup rootView) {
        return LayoutInflater.from(this).inflate(R.layout.activity_circle_switch, rootView, true);
    }

    @Override
    public String getToolbarTitle() {
        return "Circle Switch";
    }

    @Override
    public void onClick(View v) {
        switch(v.getId()){
           /* case R.id.change_position:
                rotateSwitch.setCirclePosition(Integer.parseInt(angleInput.getText().toString()));
                break;*/
        }
    }
}
